{{!

  Copyright (c) Meta Platforms, Inc. and affiliates.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

}}
{{> Autogen}}
#pragma once

#include <thrift/lib/cpp2/reflection/reflection.h>

#include <fatal/type/list.h>
#include <fatal/type/pair.h>
#include <fatal/type/sequence.h>

#include "{{program:include_prefix}}{{program:name}}_types.h"
namespace {{program:qualified_namespace}} {

namespace __fbthrift_refl {

struct __fbthrift_strings_{{program:name}} {
  {{#program:fatal_identifiers}}
  using {{identifier:name}} = {{identifier:fatal_string}};
  {{/program:fatal_identifiers}}
};

struct {{program:name}}_module_traits {
  using strings = __fbthrift_strings_{{program:name}};
  using name = strings::{{program:name}};
  using namespaces = ::fatal::list<
      {{#program:fatal_languages}}{{#fatal_languages:items}}
      ::fatal::pair<strings::{{language:safe_name}}, strings::{{language:safe_namespace}}>{{^last?}},{{/last?}}
      {{/fatal_languages:items}}{{/program:fatal_languages}}
  >;
  using enums = ::fatal::list<
      {{#program:fatal_enums}}{{#fatal_strings:items}}
      ::fatal::pair<::{{program:qualified_namespace}}::{{fatal_string:name}}, strings::{{fatal_string:name}}>{{^last?}},{{/last?}}
      {{/fatal_strings:items}}{{/program:fatal_enums}}
  >;
  using unions = ::fatal::list<
      {{#program:fatal_unions}}{{#fatal_strings:items}}
      ::fatal::pair<::{{program:qualified_namespace}}::{{fatal_string:name}}, strings::{{fatal_string:name}}>{{^last?}},{{/last?}}
      {{/fatal_strings:items}}{{/program:fatal_unions}}
  >;
  using structs = ::fatal::list<
      {{#program:fatal_structs}}{{#fatal_strings:items}}
      ::fatal::pair<::{{program:qualified_namespace}}::{{fatal_string:name}}, strings::{{fatal_string:name}}>{{^last?}},{{/last?}}
      {{/fatal_strings:items}}{{/program:fatal_structs}}
  >;
  using constants = ::fatal::list<
      {{#program:fatal_constants}}{{#fatal_strings:items}}
      strings::{{fatal_string:name}}{{^last?}},{{/last?}}
      {{/fatal_strings:items}}{{/program:fatal_constants}}
  >;
  using services = ::fatal::list<
      {{#program:fatal_services}}{{#fatal_strings:items}}
      strings::{{fatal_string:name}}{{^last?}},{{/last?}}
      {{/fatal_strings:items}}{{/program:fatal_services}}
  >;
};

} // __fbthrift_refl

class {{program:name}}_tags {
  using __fbthrift_strings = __fbthrift_refl::__fbthrift_strings_{{program:name}};
  struct __fbthrift_languages {
    {{#program:fatal_languages}}{{#fatal_languages:items}}
    using {{language:safe_name}} = __fbthrift_strings::{{language:safe_name}};
    {{/fatal_languages:items}}{{/program:fatal_languages}}
  };
  struct __fbthrift_enums {
{{#program:fatal_enums}}
    {{> fatal/fatal_using_string_declaration}}
{{/program:fatal_enums}}
  };
  struct __fbthrift_unions {
{{#program:fatal_unions}}
    {{> fatal/fatal_using_string_declaration}}
{{/program:fatal_unions}}
  };
  struct __fbthrift_structs {
{{#program:fatal_structs}}
    {{> fatal/fatal_using_string_declaration}}
{{/program:fatal_structs}}
  };
  struct __fbthrift_constants {
{{#program:fatal_constants}}
    {{> fatal/fatal_using_string_declaration}}
{{/program:fatal_constants}}
  };
  struct __fbthrift_services {
{{#program:fatal_services}}
    {{> fatal/fatal_using_string_declaration}}
{{/program:fatal_services}}
  };
 public:
  struct module {};

  using strings = __fbthrift_strings;
  using languages = __fbthrift_languages;
  using enums = __fbthrift_enums;
  using unions = __fbthrift_unions;
  using structs = __fbthrift_structs;
  using constants = __fbthrift_constants;
  using services = __fbthrift_services;
};

} // namespace {{program:qualified_namespace}}
